package com.example.student.mapper;

import com.example.student.pojo.Classes;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface ClassMapper {

    @Delete("delete from classes where dept_id = #{id}")
     void deleteByClassId(Integer id) ;

    @Select("select count(*) from classes")
     long count();
    @Select("select * from classes order by id  limit #{start},#{pageSize}")
    List<Classes> page(Integer start, Integer pageSize);

    @Select("select count(*) from classes where dept_id = #{classId}")
    int findById(Integer classId);

    @Insert("insert into classes(name,create_time,update_time,dept_id) " +
            "values(#{name},#{createTime},#{updateTime},#{deptId})")
    void insert(Classes cla);
}
